package com.terios.util;

import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * WeiboUtil.java 2012-9-27 下午4:26:22
 * 
 * @author Wang Tengrui
 */
public class WeiboUtil
{
	/**
	 * 判断设备网络是否可用
	 */
	public static boolean checkNet(Activity activity)
	{
		ConnectivityManager connectivityManager = (ConnectivityManager) activity
				.getApplicationContext().getSystemService(
						Context.CONNECTIVITY_SERVICE);
		if (null == connectivityManager)
		{
			return false;
		}
		NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
		if (null == networkInfo || !networkInfo.isAvailable())
		{
			return false;
		}
		return true;
	}

}
